package com.shangcheng.goods.feign;


import com.github.pagehelper.PageInfo;
import com.shangcheng.goods.pojo.Goods;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


@FeignClient(name = "goods")
@RequestMapping("/spu")
public interface SpuFeign {
    /***
     * 根据SpuID查询Spu信息
     * @param id
     * @return
     */
    @RequestMapping("/{id}")
    public Result<Goods> findById(@PathVariable(name = "id") Long id);

    @RequestMapping("/search/{page}/{size}")
    public Result<PageInfo> goodsList(@PathVariable(name = "page") int page, @PathVariable(name = "size") int size);

    @RequestMapping("/search2/{id}/{page}/{size}")
    public Result<PageInfo> spuList(@PathVariable(name = "id") int id, @PathVariable(name = "page") int page, @PathVariable(name = "size") int size);

    @RequestMapping(value = "/bg/{page}/{size}")
    public Result<PageInfo> findPageGoods(@PathVariable(name = "page") int page, @PathVariable(name = "size") int size);

    @RequestMapping("/save")
    public Result save(@RequestBody Goods goods);

    @RequestMapping("/update")
    public Result update(@RequestBody Goods goods);

    @RequestMapping("/logic/delete/{id}")
    public Result logicDelete(@PathVariable Long id);

    @RequestMapping("/addsc")
    public Result addsc(@RequestParam(name = "username") String username,
                        @RequestParam(name = "id") String id);

    @RequestMapping("/deletesc")
    public Result deletesc(@RequestParam String id);

    @RequestMapping(value = "/findPage")
    public Result<PageInfo> findPageIsMarketable(@RequestParam String isMarketable,
                                                 @RequestParam int page,
                                                 @RequestParam int size);

    @RequestMapping(value = "/findPageByStatus")
    public Result<PageInfo> findPageByStatus(@RequestParam String status,
                                             @RequestParam int page,
                                             @RequestParam int size);

}
